package com.ruoyi.web.controller.tool;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ShellGroovyDTO {
    private Integer a;
    private Integer b;
    private Integer num;

    /**
     * @Author: lly
     * @Date: 2023/7/2
     */
    @Service
    public static class GroovyDemo {
        private static final Logger log = LoggerFactory.getLogger(GroovyDemo.class);

        public String groovyInvokeJava() {
            List<String> lits = new ArrayList<>();
            log.info("this is SpringBoot class, groovy script invoke this method ...");
            return "this is SpringBoot class, groovy script invoke this method ...";
        }

        public String groovyInvokeJavaParam(int a, int b) {
            List<String> lits = new ArrayList<>();
            log.info("this is SpringBoot class, groovy script invoke this method ,param is a:{}, b:{}", a, b);
            return "this is SpringBoot class, groovy script invoke this method , a:" + a + ", b:" + b;
        }
    }
}